home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7705 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.9 KB

  1. Path: news-m01.ny.us.ibm.net!usenet
  2. From: hopkinc@ibm.net
  3. Newsgroups: comp.lang.pl1,comp.lang.c
  4. Subject: Re: PL/I and C
  5. Date: 28 Feb 1996 11:13:02 GMT
  6. Message-ID: <4h1dbu$3g4g@news-s01.ny.us.ibm.net>
  7. References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <4grhtv$s31@goanna.cs.rmit.EDU.AU> <4gt0tv$826@solutions.solon.com> <4gv8h0$3o2k@news-s01.ny.us.ibm.net> <4h066c$r0t@solutions.solon.com>
  8. Reply-To: Chris_harlow@artemis-intl.com
  9. NNTP-Posting-Host: slip139-92-21-74.lo.uk.ibm.net
  10. X-Newsreader: IBM NewsReader/2 v1.2
  11.  
  12. In <4h066c$r0t@solutions.solon.com>, seebs@solutions.solon.com (Peter Seebach) writes:
  13. >(not sure what the punctuation is).  Looks like a trivial operation, generates
  14. >nontrival code.  (Sort of like the hidden overhead of structure assignment
  15. >in C.)
  16.  
  17.  Depends what you call non-trivial code and what kind of strings you are assigning
  18.  and their relative declared lengths. In any case, the complexity of the generated
  19.  code is of indifference to me, I care rather for the speed at which it 
  20.  eventually executes. (Isnt this why we have compilers?)
  21. >
  22. > I've seen a *portable* C implementation of strfoo()
  23. >outperform the single-instruction way to do it on the Pentium - because
  24. >the C implementation was smarter than the P5.  You don't have to use
  25. >a feature just because it's there.
  26. >
  27. If the compiler's wrong, its wrong. My point is that if your language is too
  28. low level it can prevent the compiler using the best available methods.
  29.  (I suspect that this may be why FORTRAN is still used so extensively for
  30.   massive number crunching.. because there are no pointers in the language, the 
  31.   compiler can know about all possible side-effects and therefore do a better
  32.   job at optimisation... anyone out there know this for sure??)
  33. >Are you telling me PL/I can't have a non-fixed length string, dynamically
  34. >allocated?  If it can, the compare or copy functionality will do the same
  35. >thing strcmp() and strcpy() do at some level. 
  36.  
  37.  
  38. PL/1 can do this just fine, but the same advantages apply,  the PL/1 equivalent 
  39.  of strlen() is still just a single load instruction (variable length strings in PL/1
  40.  have a 2 byte prefix containing the current length, fixed length strings have 
  41. length known by the compiler) and therfore any compare 
  42.  or move can be performed by the fasted available machine instructions without
  43.  having to test each byte for \0
  44.  
  45.  
  46.  
  47. .. dont get me wrong, I write in PL/1 (mainframe and OS/2), assembler, C, 
  48. VB, delphi etc and they all have their advantages.....
  49.  
  50. I just think its a shame that:
  51.  (a) C got so hyped because it was essentially free when in fact it lacked
  52.        a great deal of power that other languages took fro granted.
  53.  (b) The PL/1 guys too sooooooo long to copy the good bits of C into PL/1 and
  54.        to start shipping it on the small platforms. 
  55.  
  56.  (c) So many clever programmers have to spend their time worrying about the 
  57.       details or merits of different languages when they could be writing great 
  58.       products.!!!
  59.  
  60.  
  61.